home *** CD-ROM | disk | FTP | other *** search
/ MPEG Toolkit / MPEG Toolkit.iso / os2 / mpegenc / src / os2port.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-01  |  489 b   |  27 lines

  1. #include <time.h>
  2. #include "os2port.h"
  3.  
  4. /* Process will 'consume' user time, but no system time */
  5. void times(struct tms *t)
  6.     {
  7.     t->tms_utime = time(NULL);
  8.     t->tms_stime = 0L;
  9.     }
  10.  
  11. static char tmpfn[] = "popen.tmp";
  12.  
  13. FILE *popen(char *cmd, char *mode)
  14.     {
  15.     char fullcmd[500+1];
  16.     sprintf(fullcmd, "cmd /c \"%s\" > %s", cmd, tmpfn);
  17.     if ( system(fullcmd) == -1 )
  18.         return NULL;
  19.     return fopen(tmpfn, mode);
  20.     }
  21.  
  22. void pclose(FILE *fp)
  23.     {
  24.     fclose(fp);
  25.     remove(tmpfn);
  26.     }
  27.